/**
 * 非对称算法类库使用demo
 * 主要产生密钥对、加解密
 */
package com.isoftstone.common.base;

import com.kjhxtc.crypto.api.BocCoder;
import com.kjhxtc.crypto.api.Symmetric.BocSymmetricCrypt;
import com.kjhxtc.crypto.util.encoder.Hex;

public class PassWordDecode {

	public static String decode(String password) {
		BocCoder api = new BocCoder();
		byte[]s = Hex.decode(password);
		byte[] des = new byte[0];
		try {
			des = api.BOC_Base64(s, s.length, BocCoder.DECODE);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return new String(new String(des));
	}
	public static void main(String[] args) {

		BocCoder api = new BocCoder();
		BocSymmetricCrypt rapi = new BocSymmetricCrypt();
		try{
			byte[] test_data = "123456".getBytes();
			System.out.println("RandomIs::"+Hex.toHexString(test_data));
			byte[] res = api.BOC_Base64(test_data, test_data.length, BocCoder.ENCODE);
			System.out.println("AfterCode as Hex::"+Hex.toHexString(res));
			System.out.println("AfterCode as Ascii::"+new String(res));

			String decode = PassWordDecode.decode("65476c7565576b3d");
			System.out.println(decode);

		}catch(Exception e){
			e.printStackTrace();
		}


	}
}
